home *** CD-ROM | disk | FTP | other *** search
/ SGI Varsity Update 1998 August / SGI Varsity Update 1998 August.iso / docs6.4 / relnotes / c_fe / ch5.z / ch5
Text File  |  1998-07-29  |  24KB  |  792 lines

  1.  
  2.  
  3.  
  4.                                                - 1 -
  5.  
  6.  
  7.  
  8.                     7.2.1 ANSI C Front-End Release Notes
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                                                - 2 -
  69.  
  70.  
  71.  
  72.                     DDDDooooccccuuuummmmeeeennnntttt NNNNuuuummmmbbbbeeeerrrr 000000007777----1111666655559999----000011110000
  73.  
  74.  
  75.                     5.  _K_n_o_w_n__P_r_o_b_l_e_m_s__a_n_d__W_o_r_k_a_r_o_u_n_d_s
  76.  
  77.                     Unless otherwise indicated, the following bugs
  78.                     in release 7.2.1 of the C compiler apply to both
  79.                     traditional C and ANSI C.
  80.  
  81.                     5.1  _K_n_o_w_n__P_r_o_b_l_e_m_s__(_L_i_c_e_n_s_i_n_g_)
  82.  
  83.                        +o The MIPSpro C compiler will abort if the
  84.                          license file directory (/var/flexlm)
  85.                          contains a cycle formed by symbolic links.
  86.                          For example:
  87.  
  88.                          %ls -l /var/flexlm
  89.                          lrwxr-xr-x    1 root     sys            1 Mar 13  1996 license -> .
  90.                          -rw-r--r--    1 root     sys         1162 Aug 20 17:09 license.dat
  91.  
  92.                          %cc foo.c
  93.                          Bus error (core dumped)
  94.  
  95.                          The solution is to remove the symbolic link
  96.                          that forms the cycle.
  97.  
  98.  
  99.                        +o Overloaded use of LM_LICENSE_FILE
  100.  
  101.                          Although this is not a bug, compiler users
  102.                          often have environments which specify the
  103.                          LM_LICENSE_FILE variable with a license
  104.                          file that contains licenses for other
  105.                          software. If, however, the compiler
  106.                          licenses are not installed in this
  107.                          alternate license file, compilations will
  108.                          generate the warning message illustrated
  109.                          below. The remedy is to either not use the
  110.                          LM_LICENSE_FILE variable or to set it to
  111.                          its old value followed by a colon (:) and
  112.                          the file that contains the compiler
  113.                          licenses.
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                                                - 3 -
  135.  
  136.  
  137.  
  138.                          For Example:
  139.  
  140.                          %echo $LM_LICENSE_FILE
  141.                          /usr/john_doe/license.dat
  142.                          %cc foo.c
  143.                          No such feature exists (-5,116:2) No such file or directory
  144.  
  145.                           The MIPSpro C Compiler
  146.                           (license FEATURE string = cc)
  147.                           requires a license password.
  148.  
  149.                           For license installation and trouble shooting
  150.                           information visit the web page:
  151.  
  152.                                   http://www.sgi.com/Support/Licensing/install_docs.html
  153.  
  154.                           To obtain a Permanent license (proof of purchase
  155.                           required) or an Evaluation license please
  156.                           visit our license request web page:
  157.  
  158.                                   http://www.sgi.com/Products/license.html
  159.  
  160.                                   or send a blank email message to:
  161.  
  162.                                   license@sgi.com
  163.  
  164.                           In North America, Silicon Graphics' customers may request
  165.                           Permanent licenses by sending a facsimile to:
  166.  
  167.                                   (650) 932-0537
  168.  
  169.                                   or by calling our technical support hotline
  170.  
  171.                                   1-800-800-4SGI
  172.  
  173.                           If you are Outside of North America or you are not a Silicon
  174.                           Graphics support customer then contact your local support provider.
  175.  
  176.  
  177.                          %setenv LM_LICENSE_FILE /usr/john_doe/license.dat:/var/flexlm/license.dat
  178.                          %echo $LM_LICENSE_FILE
  179.                          /usr/john_doe/license.dat:/var/flexlm/license.dat
  180.                          %cc foo.c
  181.                          %
  182.  
  183.  
  184.  
  185.  
  186.  
  187.                        +o Cryptic warning message from licensing.
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.                                                - 4 -
  201.  
  202.  
  203.  
  204.                          The first line of a warning message that
  205.                          occurs when a license file exists under
  206.                          /var/flexlm but does not contain the
  207.                          compiler license can be misleading. For
  208.                          completeness the following example
  209.                          illustrates the entire output when a
  210.                          license file exists, but a license is not
  211.                          installed:
  212.  
  213.                          %cc foo.c
  214.                          No such feature exists (-5,116)
  215.  
  216.                           The MIPSpro C Compiler
  217.                           (license FEATURE string = cc)
  218.                           requires a license password.
  219.  
  220.                           For license installation and trouble shooting
  221.                           information visit the web page:
  222.  
  223.                                   http://www.sgi.com/Support/Licensing/install_docs.html
  224.  
  225.                           To obtain a Permanent license (proof of purchase
  226.                           required) or an Evaluation license please
  227.                           visit our license request web page:
  228.  
  229.                                   http://www.sgi.com/Products/license.html
  230.  
  231.                                   or send a blank email message to:
  232.  
  233.                                   license@sgi.com
  234.  
  235.                           In North America, Silicon Graphics' customers may request
  236.                           Permanent licenses by sending a facsimile to:
  237.  
  238.                                   (650) 932-0537
  239.  
  240.                                   or by calling our technical support hotline
  241.  
  242.                                   1-800-800-4SGI
  243.  
  244.                           If you are Outside of North America or you are not a Silicon
  245.                           Graphics support customer then contact your local support provider.
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.                                                - 5 -
  267.  
  268.  
  269.  
  270.                     5.2  _K_n_o_w_n__P_r_o_b_l_e_m_s__(_6_4_-_B_i_t__a_n_d__N_3_2__M_o_d_e_)
  271.  
  272.                     This section describes problems known to exist
  273.                     in the 7.2.1 C compiler running in 64-bit and
  274.                     N32 mode.
  275.  
  276.  
  277.                     5.2.1  _P_r_e_p_r_o_c_e_s_s_o_r
  278.  
  279.                        +o A warning is issued about macro
  280.                          redefinitions, even when the new definition
  281.                          is lexically identical to the existing
  282.                          (previous) definition.
  283.  
  284.  
  285.                     5.2.2  _C_o_m_p_i_l_e_r
  286.  
  287.                        +o References of the external integer i within
  288.                          a clause of a function are assigned to
  289.                          references of the internal declaration of
  290.                          i.  The following program gets incorrect
  291.                          results if compiled -cckr -64 or -cckr -n32
  292.                          (Bug #289545).
  293.  
  294.                          void func(void)
  295.                          {
  296.                            int i=0;
  297.                            { extern int i; i = 100; }
  298.                            if ( i != 0 ){ printf("Error(in func -- i = %d)0, i); exit(1); }
  299.                          }
  300.  
  301.                          extern int i;
  302.                          void func2(void) { i += 100; }
  303.                          int main(void)
  304.                          {
  305.                            func();
  306.                            func2();
  307.  
  308.                            if ( i == 200 ){ exit(0); }
  309.                            else{ printf("Error(in main  -- i = %d)0, i); exit(1); }
  310.                          }
  311.  
  312.  
  313.  
  314.                        +o Redefinition of previously prototyped
  315.                          functions do not generate a meaningful
  316.                          warning message.  When compiling the
  317.                          following program a deceptive warning
  318.                          message gets generated:
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                                                - 6 -
  333.  
  334.  
  335.  
  336.                          %cat t.c
  337.                                  #include <unistd.h>
  338.                                  #include <stdio.h>
  339.  
  340.                                  int
  341.                                  main(int argc, char *argv[])
  342.                                  {
  343.                                      int opt;
  344.                                      extern int getopt();
  345.  
  346.                                      opt= getopt(argc, argv, "abc");
  347.                                      return 0;
  348.                                  }
  349.                                  % cc -n32 -fullwarn t.c
  350.                                  "t.c", line 10: remark(1498): no prototype for the call to getopt
  351.                                        opt = getopt(argc, argv, "abc");
  352.                                              ^
  353.  
  354.                          Actually, the problem is the redefinition
  355.                          (outside of unistd.h) of getopt() within
  356.                          the program (Bug #323611).
  357.  
  358.                        +o The compiler does not generate a warning
  359.                          message for redundant globals.  For
  360.                          example, the following program compiles
  361.                          without error or warning in all modes.
  362.  
  363.                          int rg = 0;
  364.                          int rg;
  365.  
  366.                          main()
  367.                          {
  368.                          foo(rg);
  369.                          }
  370.  
  371.                     5.3  _K_n_o_w_n__P_r_o_b_l_e_m_s__(_3_2_-_B_i_t__M_o_d_e_)
  372.  
  373.                     This section describes problems known to exist
  374.                     in the 7.2.1 C compiler running in 32-bit mode.
  375.  
  376.  
  377.                     5.3.1  _P_r_e_p_r_o_c_e_s_s_o_r
  378.  
  379.                        +o The following is permitted by the _c_f_e
  380.                          preprocessor:
  381.  
  382.                               #undef __STDC__
  383.  
  384.                          However, it should be illegal.
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.                                                - 7 -
  399.  
  400.  
  401.  
  402.                        +o The source location for ``f()'' in:
  403.  
  404.                               #  /* some rather
  405.                                        lengthy
  406.                                        and multi-line
  407.                                        comment */
  408.                                  void f(void) {...}
  409.  
  410.                          will be wrongly perceived by _c_f_e to begin
  411.                          at the line where the comment starts, since
  412.                          the "#" is assumed to be a line-directive
  413.                          while the whole comment is viewed as a
  414.                          single space within the line-directive.
  415.                          This will cause _d_b_x to list the wrong
  416.                          source lines for statements in the body of
  417.                          ``f()''.
  418.  
  419.                        +o The -_w_l_i_n_t option causes an incorrect
  420.                          ``implicit type conversion'' warning when
  421.                          an enumerator is assigned to an enumeration
  422.                          variable, and may also cause incorrect
  423.                          ``used before set'' warnings for variables
  424.                          in the controlling expressions of loops:
  425.  
  426.                               void
  427.                               foo(int *head)
  428.                               {
  429.                                  enum E {e1, e2, e3} c;
  430.                                  int *p, *nextp;
  431.                                  int i;
  432.  
  433.                                  /* incorrect warning: "implicit conversion from int to enum" */
  434.                                  c = e1;
  435.  
  436.                                  /* incorrect warning: "i may be used before set" */
  437.                                  do {i = *(p++);} while (!i);
  438.  
  439.                                  /* incorrect warning: "nextp may be used before set" */
  440.                                  for (p = head; p; p = nextp) nextp = p;
  441.                               }
  442.  
  443.                        +o There is a problem with constant
  444.                          propagation in the context of weakextern
  445.                          definitions.  For the source:
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.                                                - 8 -
  465.  
  466.  
  467.  
  468.                               #include <stdio.h>
  469.                               extern int a;
  470.                               #pragma weak a=b
  471.                               int b = 3;
  472.                               main()
  473.                               {
  474.                                  a = 5;
  475.                                  printf("%d, %d", a, b);
  476.                               }
  477.  
  478.                          the output when compiled without any
  479.                          optimization (-_O_0) ``5, 5'', as expected,
  480.                          while with optimization the output is  ``5,
  481.                          3''.  The latter is a result of constant
  482.                          propagation, which reduces the body of
  483.                          ``main()'' to:
  484.  
  485.                               printf("%d, %d", 5, b);
  486.  
  487.                          thus effectively eliminating the assignment
  488.                          to ``a'' and its alias ``b''.
  489.  
  490.  
  491.                     5.3.2  _C_o_m_p_i_l_e_r
  492.  
  493.                        +o Signed and unsigned ``long long''
  494.                          bitfields, spanning across a 32-bit (word)
  495.                          aligned boundary, can only be accessed
  496.                          through the ``.'' operator when the left-
  497.                          hand side is an addressable lvalue.  This
  498.                          is a limitation of our compiler front-end
  499.                          (_c_f_e) implementation and _c_f_e will emit
  500.                          error messages when this constraint is
  501.                          violated.  In earlier versions of the
  502.                          compiler, _c_f_e terminated with an assertion
  503.                          for such expressions.
  504.  
  505.                        +o An indexing expression with a complicated
  506.                          index expression may sometime generate
  507.                          illegal ucode, which causes _u_g_e_n to core
  508.                          dump.  A workaround is to move the index
  509.                          expression out and assign it to a temporary
  510.                          variable, or just change the expression.
  511.                          The following illustrates the only known
  512.                          case of this happening:
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.                                                - 9 -
  531.  
  532.  
  533.  
  534.                               char board[19];
  535.                               int capture[2];
  536.                               setboard (int x)
  537.                               {
  538.                                  capture[!(board[x])]++;    /* Ugen coredumps on this! */
  539.                                  capture[(board[x])?0:1]++; /* This works just fine! */
  540.                               }
  541.  
  542.                        +o A standalone _l_i_n_t is available, but it does
  543.                          not support the same options and
  544.                          compilation modes supported by the C
  545.                          compiler (it supports the the AT&T SVR4
  546.                          compilation modes, and treats ``long long''
  547.                          types as ``long'').  Unless _l_i_n_t is used to
  548.                          handle _l_i_n_t-directives, to provide _l_i_n_t_2
  549.                          diagnostics, or to produce the _l_i_n_t output
  550.                          files, we instead strongly recommend use of
  551.                          the -_w_l_i_n_t option with the _c_c command.
  552.                          This option works with all the other
  553.                          compiler options and flags, including
  554.                          compilation in ANSI mode.  Note that -_w_l_i_n_t
  555.                          does not produce the traditional output
  556.                          files from the _l_i_n_t passes, nor does it
  557.                          handle _l_i_n_t directives, while it does
  558.                          provide _l_i_n_t-like diagnostics.
  559.  
  560.  
  561.                     5.4  _K_n_o_w_n _P_r_o_b_l_e_m_s _w_i_t_h _W_o_r_k_a_r_o_u_n_d_s (_6_4-_B_i_t _a_n_d
  562.                          _N_3_2 _M_o_d_e)
  563.  
  564.  
  565.  
  566.                        +o -IPA and -g cannot be used on the same
  567.                          command line.  The compiler will
  568.                          automatically turn off interprocedural
  569.                          optimizations if -g is specified.
  570.  
  571.                        +o -OPT:fast_io=ON gives incorrect results
  572.  
  573.                          Under certain circumstances, use of this
  574.                          flag will lead to incorrect results. (Bug
  575.                          446782)
  576.  
  577.                        +o Use of certain characters reserved by the
  578.                          front-end will cause the compiler to core
  579.                          dump. The reserved characters are 0x81 and
  580.                          0x82. (Bug 480882)
  581.  
  582.                        +o The following code does not work when
  583.                          compiled -mp.  It occurs for both -32, and
  584.                          -n32/-64.
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.                                                - 10 -
  597.  
  598.  
  599.  
  600.                          typedef struct {
  601.                                  int widget;
  602.                          } THING;
  603.  
  604.                          typedef struct {
  605.                              THING part;
  606.                          } OTHER_THING;
  607.  
  608.                          extern void setup();
  609.  
  610.                          main()
  611.                          {
  612.                          OTHER_THING y;
  613.  
  614.                          setup(&y);
  615.  
  616.                          #pragma parallel
  617.                          #pragma local(x)
  618.                          #pragma shared(y)
  619.                                  {
  620.                                  OTHER_THING x;
  621.                                  x.part = y.part;
  622.                                  }
  623.                          }
  624.  
  625.                          It is possible to work around this problem
  626.                          by avoiding the use of anonymous structure
  627.                          types.  In other words, put some kind of
  628.                          name in between struct and the opening
  629.                          brace of the structure definition, and this
  630.                          problem goes away.
  631.  
  632.  
  633.                     5.5  _K_n_o_w_n _P_r_o_b_l_e_m_s _w_i_t_h _W_o_r_k_a_r_o_u_n_d_s (_3_2-_B_i_t
  634.                          _M_o_d_e)
  635.  
  636.                        +o In 3.17 and earlier versions of the
  637.                          compiler, no diagnostics were emitted (by
  638.                          default) in -_c_c_k_r mode for a function
  639.                          redeclaration with incompatible parameter
  640.                          types.  This could be highly error-prone,
  641.                          since an argument could be passed to the
  642.                          same function in differing ways, dependent
  643.                          on which declaration were in scope at the
  644.                          point of call.  Consider the following
  645.                          code:
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.                                                - 11 -
  663.  
  664.  
  665.  
  666.                               #include <stdio.h>
  667.                               int f(float f1, float f2);
  668.                               f(f1, f2)
  669.                                  float f1, f2;
  670.                               {
  671.                                  printf("f1=%g, f2=%g0, f1, f2);
  672.                               }
  673.                               main()
  674.                               {
  675.                                  f(17.17, 17.17);
  676.                               }
  677.  
  678.                          The unprototyped function definition
  679.                          expects float arguments to be promoted to
  680.                          doubles (64 bits entities), while the call
  681.                          in fact heeds the prototype and passes the
  682.                          arguments as floats (32 bits entities).
  683.                          The values printed will be unpredictable.
  684.                          To avoid this kind of unexpected behavior
  685.                          we highly recommend that users compile
  686.                          their code with -_p_r_o_t_o_t_y_p_e_s in -_c_c_k_r mode.
  687.                          For redeclarations, where references to
  688.                          parameters in the function body may access
  689.                          a different bit pattern than that passed on
  690.                          the caller site (as in the above example),
  691.                          we now issue an error in -_c_c_k_r mode.  Other
  692.                          forms of incompatible redeclarations still
  693.                          pass without any diagnostics.  The old
  694.                          (ccom) compiler sometimes successfully
  695.                          combined such incompatible redeclarations,
  696.                          but not always.  We therefore found it
  697.                          sounder to disallow the most blatant forms
  698.                          of mismatches in this version of the
  699.                          compiler.
  700.  
  701.                        +o Note that _l_i_n_t incorrectly diagnoses a
  702.                          syntax error for the latter of the
  703.                          following two declarations for
  704.                          ``XSynchronize'':
  705.  
  706.                               typedef int Display;
  707.                               extern int (*XSynchronize(int*))();
  708.                               extern int (*XSynchronize(Display*))();
  709.  
  710.                          The first form of declaration (without the
  711.                          typedef) can be used as a workaround for
  712.                          this particular problem.
  713.  
  714.                        +o The compiler will incorrectly diagnose the
  715.                          last of the initializers in the following
  716.                          code fragment as an incorrect initializing
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.                                                - 12 -
  729.  
  730.  
  731.  
  732.                          expression:
  733.  
  734.                               typedef unsigned int size_t;
  735.                               typedef struct uacdef
  736.                               {
  737.                                 unsigned int  *uacind;
  738.                                 unsigned int  *uacaln;
  739.                                 unsigned int  *uacrcp;
  740.                                 unsigned int  *uaccal;
  741.                               } uacdef;
  742.  
  743.                               size_t uacsiz[] = {
  744.                                  (size_t)&(((uacdef*)0))->uacrcp,
  745.                                  (1&0x40 ? sizeof(uacdef) : (unsigned int)&(((uacdef*)0))->uacrcp),
  746.                                  (1&0x40 ? sizeof(uacdef) : (size_t)&(((uacdef*)0))->uacrcp)
  747.                               };
  748.  
  749.                          The first two forms of initializers may be
  750.                          used as a workaround for this problem.
  751.  
  752.                        +o Benchmarks using computational kernels that
  753.                          operate on arrays with dimensions of a
  754.                          modulus of the cache size can cause cache
  755.                          line thrashing. This condition will usually
  756.                          manifest in a program taking much longer to
  757.                          compile than expected, and can be analyzed
  758.                          further by monitoring system performance
  759.                          statistics such as I/O use during
  760.                          compilation.  The remedy is to increase the
  761.                          size of the array by a multiple of the
  762.                          cache line size.  Because cache line size
  763.                          is fixed for each specific architecture,
  764.                          check your hardware documentation to see
  765.                          what applies for your system.
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.